<?php
require_once 'config.php'; 
require_once 'Tools.class.php'; 
require_once 'User.class.php'; 
require_once 'HTML.class.php'; 
class Exam{
    private $line1="-----------------\n";
    private $line2="===============\n";
	
    //借阅查询
    public function getExam($openid){
        //@KSB
        #SJ:(01/07)07:30--09:30
        #KCMC:大学语文（必选）
        #JSID:09-2010
        #XYMC:信息管理学院
        #ZYMC:计算机网络技术(专科)
        #LNAME:理科楼
        #RS:51
        #NJ:2012
        $xh=User::getXH($openid);
        $code=Tools::getHttp(DZU_URL."exam.asp?xh=".$xh);
        $strTitle="【考试查询结果】\n".$this->line2;
        $lib = explode("@KSB",$code);
        for($i=1;count($lib)>$i;$i++){

            $SJ = Tools::getInfo(trim($lib[$i]),"SJ");
            $KCMC = Tools::getInfo(trim($lib[$i]),"KCMC");
            $JSID = Tools::getInfo(trim($lib[$i]),"JSID");
            $XYMC = Tools::getInfo(trim($lib[$i]),"XYMC");
            $ZYMC = Tools::getInfo(trim($lib[$i]),"ZYMC");
            $LNAME = Tools::getInfo(trim($lib[$i]),"LNAME");
            $RS = Tools::getInfo(trim($lib[$i]),"RS");
            $NJ = Tools::getInfo(trim($lib[$i]),"NJ");

            $t1=substr($SJ , 7);
            $t2=substr($SJ, 1,5);

            $str.= "名称：".$KCMC;
            $str.= "\n时间：".$t1;
            $str.= "\n日期：".$t2;
            $str.= "\n地点：".$LNAME.$JSID;
            $str.= "\n专业：".$ZYMC.'('.$RS.'人)'."\n".$this->line1;
        }//for

        if($str!=""){
            $str = $strTitle.substr($str,0,-(strlen($this->line1)));
        }else{
            $str=$strTitle."暂无考试信息";
        }
        return $str;
    }  

}
?>